<template>
  <h3>姓名：{{ msg }}</h3>
  <h3>年龄：{{ age }}</h3>
  <slot name="demo"></slot>

  <button @click="schoolDoHello">触发自定义事件 doHello</button>
</template>

<script>


export default {
  name: 'School-Comp',
  props: ['msg', 'age'],
  emits: ['doHello'], // VUE3中 自定义事件需求接收
  setup(props, context) {
    console.log('setup.........', props, context);

    console.log('setup.........attrs ', context.attrs);
    console.log('setup.........emit ', context.emit);
    console.log('setup.........slots ', context.slots);

    function schoolDoHello() {
      context.emit('doHello', 'hello')
    }

    return { schoolDoHello }

  },
  beforeCreate() {
    console.log('beforeCreate.........');
  }
}
</script>

<style>
</style>
